home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Resource for Source: C/C++
/
Resource for Source - C-C++.iso
/
codelib9
/
v_11_01
/
1101036b
< prev
next >
Wrap
Text File
|
1995-11-01
|
1KB
|
53 lines
/* LISTING 2: C functions to encapsulate the MS Windows
WNDCLASS.
*/
#include "windows.h"
typedef int BOOL;
typedef WNDCLASS MYWCLASS;
typedef WNDPROC MYWNDPROC;
typedef HINSTANCE MYHINSTANCE;
typedef HCURSOR MYHCURSOR;
typedef HBRUSH MYHBRUSH;
void WCL_Init (MYWCLASS *wndclass, char *szAppName,
MYWNDPROC WndProc, MYHINSTANCE hInstance,
char *szMenuName)
{
wndclass->style = CS_HREDRAW | CS_VREDRAW;
wndclass->lpfnWndProc = WndProc;
wndclass->cbClsExtra = 0;
wndclass->cbWndExtra = 0;
wndclass->hInstance = hInstance;
wndclass->hIcon = LoadIcon (NULL, IDI_APPLICATION);
wndclass->hCursor = LoadCursor (NULL, IDC_ARROW);
wndclass->hbrBackground =
GetStockObject (WHITE_BRUSH);
wndclass->lpszMenuName = szMenuName;
wndclass->lpszClassName = szAppName;
}
void WCL_SetCursor (MYWCLASS *wndclass,
MYHCURSOR hCursor)
{
wndclass->hCursor = hCursor;
}
void WCL_SetBackground (MYWCLASS *wndclass,
MYHBRUSH hbrBackground)
{
wndclass->hbrBackground = hbrBackground;
}
void WCL_SetMenu (MYWCLASS *wndclass, char *szMenuName)
{
wndclass->lpszMenuName = szMenuName;
}
BOOL WCL_RegisterClass (MYWCLASS *wndclass)
{
return (RegisterClass (wndclass));
}